package com.zx.cloud.controller;

import io.swagger.annotations.ApiOperation;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.google.gson.Gson;
import com.zx.cloud.ApiVersion;
import com.zx.cloud.controller.client.ShopClient;
import com.zx.cloud.domain.Shop;
import com.zx.cloud.model.response.ObjectDataResponse;
import com.zx.cloud.model.response.Response;
import com.zx.cloud.util.Page;

/**
 * @Description:
 *
 * @author       Yan Weiwei
 * @Create Time: 2017年11月1日下午1:44:39
 */

@RestController
@RequestMapping(value = ApiVersion.MANAGER_V1_PREFIX + "/shop")
public class ShopController {

	@Autowired
	private ShopClient shopClient;
	

	
	@ApiOperation(value = "查询商户列表信息" , notes = "查询商户列表信息")
	@RequestMapping(value = "/queryClientInfo", method = RequestMethod.POST)
	@ResponseBody
	public Response queryClientInfo(@RequestBody Shop shop){
		Gson gson=new Gson();
		ObjectDataResponse<Page<Object>>  loginRequestObj = shopClient.queryClientInfo(shop);
		return loginRequestObj;
	}
	
	
	@ApiOperation(value = "添加商户", notes = "添加商户")
	@RequestMapping(value = "addClientInfo", method = RequestMethod.POST)
	@ResponseBody
	public ObjectDataResponse<Integer> addClientInfo(@RequestBody Shop shop) {
		Gson gson=new Gson();
		ObjectDataResponse<Integer> success = shopClient.addClientInfo(shop);
		return success;
	}
	
	
	 //删除
	@ApiOperation(value = "删除商户" , notes = "删除商户")
	@RequestMapping(value = "deletClientInfo", method = RequestMethod.POST)
	@ResponseBody
	public ObjectDataResponse<Integer> deletClientInfo(@RequestBody Shop shop) {
		ObjectDataResponse<Integer> success = shopClient.deletClientInfo(shop);
		Gson gson=new Gson();
		System.out.println("========="+gson.toJson(shop));
		return success;
	}
	
	
}
